package com.eascs.o2o.recruit.controller;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.eascs.o2o.recruit.entity.RecruitInfoVO;
import com.eascs.o2o.recruit.service.RecruitService;

@Controller
@RequestMapping("/recruit")
public class RecruitController {

	@Autowired
	@Qualifier("recruitServiceImpl")
	private RecruitService recruitService;
	
	@RequestMapping(value = "/save",method=RequestMethod.POST)
	@ResponseBody
	public String save(@ModelAttribute RecruitInfoVO recruitInfoVO){
		JSONObject json = new JSONObject();
		recruitInfoVO.setCreateTime(new Date());
		int result=recruitService.saveRecruitInfo(recruitInfoVO);
		json.put("result", result);
        return json.toString();
	}
	
	@RequestMapping(value = "/query",method=RequestMethod.POST)
	@ResponseBody
	public String queryRecruitInfo(@ModelAttribute RecruitInfoVO recruitInfoVO){
		JSONObject json = new JSONObject();
		recruitInfoVO.setCreateTime(new Date());
		List<RecruitInfoVO> result=recruitService.queryRecruitInfo(recruitInfoVO);
		json.put("result", result);
        return json.toString();
	}
	
	
}
